package com.powernode.factory;

import com.powernode.strategy.LoginStrategy;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * @create: 2024/7/16
 * @author: gyhe10
 * @description: 登录策略工厂类
 **/

@Component
public class LoginStrategyFactory {

    @Resource
    private Map<String, LoginStrategy> loginStrategyMap = new HashMap<>();

    /**
     * 根据登录类型获取对应的登录策略
     * @param loginType
     * @return
     */
    public LoginStrategy getInstance(String loginType) {
        return loginStrategyMap.get(loginType);
    }
}
